Categories

Versions

You are viewing the RapidMiner Studio documentation for version 10.1 - Check here for latest version

Replace Rare Values (Operator Toolbox)

Synopsis

In many use case you run into nominal attributes with many different strings. An example for this are regions. There might be regions which are frequent while others are infrequent. These infrequent regions are not useful for model generation, because the algorithm can not learn a general rule on it. This operator copes with this problem. It replaces all strings which are rare with a generic, configurable string. Rare is defined by a absolute or relative threshold. The operator also generates a preprocessing model which can be applied on new data and grouped with the Group Model operator.

Input

  • exa (Data Table)

    The input ExampleSet.

Output

  • exa (Data Table)

    The ExampleSet with the replaced values.

  • ori (Data Table)

    The original ExampleSet.

  • mod

    The preprocessing model which can applied on new data by the Apply Model operator.

Parameters

  • attribute_filter_type

    This parameter allows you to select the attribute selection filter; the method you want to use for selecting attributes. It has the following options:

    • all: This option selects all the attributes of the ExampleSet, no attributes are removed. This is the default option.
    • single: This option allows the selection of a single attribute. The required attribute is selected by the attribute parameter.
    • subset: This option allows the selection of multiple attributes through a list (see parameter attributes). If the meta data of the ExampleSet is known all attributes are present in the list and the required ones can easily be selected.
    • regular_expression: This option allows you to specify a regular expression for the attribute selection. The regular expression filter is configured by the parameters regular expression, use except expression and except expression.
    • value_type: This option allows selection of all the attributes of a particular type. It should be noted that types are hierarchical. For example real and integer types both belong to the numeric type. The value type filter is configured by the parameters value type, use value type exception, except value type.
    • block_type: This option allows the selection of all the attributes of a particular block type. It should be noted that block types may be hierarchical. For example value_series_start and value_series_end block types both belong to the value_series block type. The block type filter is configured by the parameters block type, use block type exception, except block type.
    • no_missing_values: This option selects all attributes of the ExampleSet which do not contain a missing value in any example. attributes that have even a single missing value are removed.
    • numeric_value_filter: All numeric attributes whose examples all match a given numeric condition are selected. The condition is specified by the numeric condition parameter. Please note that all nominal attributes are also selected irrespective of the given numerical condition.
    Range:
  • attribute

    The required attribute can be selected from this option. The attribute name can be selected from the drop down box of the parameter if the meta data is known.

    Range:
  • attributes

    The required attributes can be selected from this option. This opens a new window with two lists. All attributes are present in the left list. They can be shifted to the right list, which is the list of selected attributes that will make it to the output port.

    Range:
  • regular_expression

    Attributes whose names match this expression will be selected. The expression can be specified through the edit and preview regular expression menu. This menu gives a good idea of regular expressions and it also allows you to try different expressions and preview the results simultaneously.

    Range:
  • use_except_expression

    If enabled, an exception to the first regular expression can be specified. This exception is specified by the except regular expression parameter.

    Range:
  • except_regular_expression

    This option allows you to specify a regular expression. Attributes matching this expression will be filtered out even if they match the first expression (expression that was specified in regular expression parameter).

    Range:
  • value_type

    This option allows to select a type of attribute. One of the following types can be chosen: nominal, numeric, integer, real, text, binominal, polynominal, file_path, date_time, date, time.

    Range:
  • use_value_type_exception

    If enabled, an exception to the selected type can be specified. This exception is specified by the except value type parameter.

    Range:
  • except_value_type

    The attributes matching this type will be removed from the final output even if they matched the before selected type, specified by the value type parameter. One of the following types can be selected here: nominal, numeric, integer, real, text, binominal, polynominal, file_path, date_time, date, time.

    Range:
  • block_type

    This option allows to select a block type of attribute. One of the following types can be chosen: single_value, value_series, value_series_start, value_series_end, value_matrix, value_matrix_start, value_matrix_end, value_matrix_row_start.

    Range:
  • use_block_type_exception

    If enabled, an exception to the selected block type can be specified. This exception is specified by the except block type parameter.

    Range:
  • except_block_type

    The attributes matching this block type will be removed from the final output even if they matched the before selected type by the block type parameter. One of the following block types can be selected here: single_value, value_series, value_series_start, value_series_end, value_matrix, value_matrix_start, value_matrix_end, value_matrix_row_start.

    Range:
  • numeric_condition

    The numeric condition used by the numeric condition filter type. A numeric attribute is kept if all examples match the specified condition for this attribute. For example the numeric condition '> 6' will keep all numeric attributes having a value of greater than 6 in every example. A combination of conditions is possible: '> 6 && < 11' or '<= 5 || < 0'. But && and || cannot be used together in one numeric condition. Conditions like '(> 0 && < 2) || (>10 && < 12)' are not allowed because they use both && and ||. Nominal attributes are always kept, regardless of the specified numeric condition.

    Range:
  • include_special_attributes

    Special attributes are attributes with special roles. These are: id, label, prediction, cluster, weight and batch. Also custom roles can be assigned to attributes. By default all special attributes are delivered to the output port irrespective of the conditions in the attribute selection. If this parameter is set to true, special attributes are also tested against conditions specified in the attribute selection and only those attributes are selected that match the conditions.

    Range:
  • invert_selection

    If this parameter is set to true the selection is reversed. In that case all attributes matching the specified condition are removed and the other attributes remain in the output ExampleSet. Special attributes are kept independent of the invert selection parameter as along as the include special attributes parameter is not set to true. If so the condition is also applied to the special attributes and the selection is reversed if this parameter is checked.

    Range:
  • use_relative_threshold If checked a relative threshold is used. The relative threshold value has to be specifiec Range:
  • relative_threshold_value If the ratio of number of occurrences for a value and the total number of examples is less than this relative threshold the corresponding value is replaced by the replacement value. Range:
  • threshold The absolute threshold. If the number of occurrences for a value is less then this the value gets replaced by the replacement value. Range:
  • replacement_value The string all rare values will be replaced with. Range:
  • replace_if_unknown When the model is applied on a new data set with a Apply Model operator it can happen that new values come up. If this parameter is checked these new values will be replaced with the replacement value as well. They will not be changed if the parameter is not checked. Range:

Tutorial Processes

Replace Customer Data

This process creates example customer data. The Replace Rare Values operator is used to replace rare values in this. Rare values means values with less than 10 occurrences. Since names are unique they all get mapped to "Other". The polynominal zip code is just partly replaced.